#include "widget.h"
#include "ui_widget.h"
#include <QVBoxLayout>
#include <QStackedWidget>
#include <QComboBox>
#include <QTextEdit>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    QVBoxLayout* vl = new QVBoxLayout(this);
    QStackedWidget* sw = new QStackedWidget(this);
    QComboBox* cb = new QComboBox(this);
    vl->addWidget(sw);
    vl->addWidget(cb);

    QTextEdit* te1 = new QTextEdit("111", sw);
    QTextEdit* te2 = new QTextEdit("222", sw);
    QTextEdit* te3 = new QTextEdit("333", sw);
    sw->addWidget(te1);
    sw->addWidget(te2);
    sw->addWidget(te3);

    cb->addItem("a");
    cb->addItem("b");
    cb->addItem("c");

    connect(cb, SIGNAL(activated(int)), sw, SLOT(setCurrentIndex(int)));


}

Widget::~Widget()
{
    delete ui;
}
